/*! 
 *  OpenAL based implementation for Audio Wrapper Interface
 *  -
 *  Implementation of an audio wrapper, Sound Programming course
 *  Master in Computer Game Development, Verona, Italy
 *  -
 *  \author Andrea Casaccia
 *  \date 08 July 2012
 */

#pragma once

#include "AudioWrapper.h"
#include "al.h"
#include "AL/alut.h"

class AudioWrapperOpenAL : public AudioWrapper {

private:
	ALuint mBufferHandle;
	ALuint mSourceHandle;

	void clampFloat(float &value, float min, float max);

	static const float MIN_PITCH;
	static const float MAX_PITCH;
	static const float MIN_GAIN;
	static const float MAX_GAIN;
	static const float MIN_PAN;
	static const float MAX_PAN;


public:
	AudioWrapperOpenAL();

	bool initialize();
	bool load(char* const filename);
	void unload();
	void play();
	void pause();
	void stop();
	void exit();
	void playPause();

	bool isLooping();
	void setLooping(bool val);
	void toggleLooping();

	ALfloat getVolume() const;
	void setVolume(ALfloat val);

	ALfloat getPan() const;
	void setPan(ALfloat val);

	ALfloat getPitch() const;
	void setPitch(ALfloat val);

};

